const userModel = require("../db/mysql.js");
const md5 = require("md5");
const jwt = require('jsonwebtoken');
const checkToken = require('../token/checkToken.js');
const getToken = require('../token/checkToken.js');
const config = require('../db/config.js')



module.exports = {
    async userinfo (ctx,next) {
        let { body} = ctx.request.body;
        try {
            let tokenContent = await checkToken(ctx);
            if(tokenContent) {
                ctx.body = {
                    code: 200,
                    message:'success',
                    data:{
                        userName:tokenContent.userName
                    }
                  }
            }
            
        } catch (e) {
            console.log(e)
            ctx.body = {
              code: 500,
              msg: '登录失败，服务器异常!'
            }
        }

    }
}
